package svc

import (
	"gozero/login/internal/config"
	"gozero/login/internal/db"

	"github.com/zeromicro/go-zero/core/stores/redis"
	"github.com/zeromicro/go-zero/core/stores/sqlx"
)

type ServiceContext struct {
	Config config.Config
	Mysql  sqlx.SqlConn
	Redis  *redis.Redis
}

func NewServiceContext(c config.Config) *ServiceContext {
	mysql := db.NewMysql(c.MysqlConfig)
	redis := db.NewRedis(c.RedisConfig)
	return &ServiceContext{
		Config: c,
		Mysql:  mysql,
		Redis:  redis,
	}
}
